package EnumDemo;

public class Test2 {
    public static void main(String[] args) {
        move1(0);
        move2(Direction.DOWN);
    }

    // 通过常量 实现信息分类
    public static void move1(int direction){
        switch (direction) {
            case Constant.RIGHT:
                System.out.println("向右移动");
                break;
            case Constant.UP:
                System.out.println("向上移动");
                break;
            case Constant.DOWN:
                System.out.println("向下移动");
                break;
            case Constant.LEFT:
                System.out.println("向左移动");
                break;
            default:
                System.out.println("无效的移动方向");
                break;
        }
    }

    // 通过枚举类 完成信息分类
    public static void move2(Direction direction){
        switch(direction){
            case RIGHT:
                System.out.println("向右移动");
                break;
            case UP:
                System.out.println("向上移动");
                break;
            case DOWN:
                System.out.println("向下移动");
                break;
            case LEFT:
                System.out.println("向左移动");
                break;
            default:
                System.out.println("无效的移动方向");
                break;
        }
    }
}
